package com.soft.dao;

import com.soft.IBaseDao.IBaseDao;
import com.soft.pojo.Emp;
import com.soft.utils.DBUtil;

import java.util.List;

/**
 * @author ruoxi
 * @create 2021-12-25 19:04
 */
public class WorkDaoImpl implements IBaseDao<Emp> {
    @Override
    public int add(Emp var1) {
        return 0;
    }

    @Override
    public int del(int var1) {
        return 0;
    }

    @Override
    public int update(Emp var1) {
        return 0;
    }

    /**
     * 查询所有员工
     * @return
     */
    @Override
    public List<Emp> selectByAll() {
        return DBUtil.query("select * from emp", Emp.class);
    }

    @Override
    public Emp selectByKey(Emp var1) {
        return null;
    }

    public List<Emp> selectEmpByPage(int currentPage, int currentCount){
        return DBUtil.query("select * from emp e,dept d where e.deptno = d.dno limit ?,?", Emp.class,currentPage,currentCount);
    }

    public List<Emp> selectByEno(String eno) {
        return DBUtil.query("select * from emp e,dept d where e.deptno = d.dno and e.eno = ?", Emp.class, eno);
    }

    public List<Emp> selectByIntEno(int eno) {
        return DBUtil.query("select * from emp e,dept d where e.deptno = d.dno and e.eno = ?", Emp.class, eno);
    }
}
